<form method="post" action="../admin/submitSettings.php">
<input type="hidden" name="coachName" value="<?echo $loggedInTeam->coachName?>">
<table cellpadding="10">
<?if ($loggedInTeam->isAdmin) {?>
<tr>
<td><h2>System Settings</h2></td></tr>
<tr>
<tr>
<td>Trades</td><td><input type="checkbox" name="trades" <?if ($settings->trades == "ON") {?>checked<?}?> value="ON" /></td></tr>
<tr>
<td>Time Limit</td><td><input type="checkbox" name="timeLimit" <?if ($settings->timeLimit == "ON") {?>checked<?}?> value="ON" /></td></tr>
<tr>
<td>Bot</td><td><input type="checkbox" name="bot" <?if ($settings->bot == "ON") {?>checked<?}?> value="ON" /></td></tr>
<tr>
<td>Pick Expiry</td><td><input type="text" name="timeLength" value="<?echo $settings->timeLength?>" /></td></tr>
<tr>
<td>Trades Page ID</td><td><input type="text" name="tradesPageID" value="<?echo $settings->tradesPageID?>" /></td></tr>
<tr>
<td>Picks Page ID</td><td><input type="text" name="picksPageID" value="<?echo $settings->picksPageID?>" /></td></tr>
<tr>
<td>Season in progress</td><td><input type="checkbox" name="seasonInProgress" <?if ($settings->seasonInProgress == "YES") {?>checked<?}?> value="YES" /></td></tr>
<tr>
<td>Submitted Teams Page ID</td><td><input type="text" name="submittedTeamsPageID" value="<?echo $settings->submittedTeamsPageID?>" /></td></tr>
<tr>
<td>Results Page ID</td><td><input type="text" name="resultsPageID" value="<?echo $settings->resultsPageID?>" /></td></tr>
<tr>
<td>Forum ID</td><td><input type="text" name="forumID" value="<?echo $settings->forumID?>" /></td></tr>
<tr>
<td>Full Lockout Penalty</td><td><input type="text" name="fullLockoutPenalty" value="<?echo $settings->fullLockoutPenalty?>" /></td></tr>
<tr>
<td>Partial Lockout Penalty</td><td><input type="text" name="partialLockoutPenalty" value="<?echo $settings->partialLockoutPenalty?>" /></td></tr>
<?}?>
<tr>
<td><h2>User Settings</h2></td></tr>
<tr>
<td valign="top">Use preferences</td>
<td><table><tr><td>For all coming picks</td><td><input type="radio" name="usePreferences" <?if ($userSettings->getSettingValue(SettingType::UsePreferences) == "ALL") {?>checked<?}?> value="ALL" /></td></tr>
<tr><td>Only for the next pick</td><td><input type="radio" name="usePreferences" <?if ($userSettings->getSettingValue(SettingType::UsePreferences) == "ONE") {?>checked<?}?> value="ONE" /></td></tr>
<tr><td>Don't use</td><td><input type="radio" name="usePreferences" <?if ($userSettings->getSettingValue(SettingType::UsePreferences) == "NONE") {?>checked<?}?> value="NONE" /></td></tr>
</table></td>
</tr>
<tr>
<td>Trades per page</td><td><input type="text" name="tradesPerPage" size="10" onkeypress="return isNumberKey(event)" maxlength="3" value="<?echo $userSettings->getSettingValue(SettingType::TradesPerPage)?>" /></td>
</tr>
<?if (KPPStatusBoard::isAuthentic($loggedInTeam->coachName)) {?>
<tr>
<td>Reviews per page</td><td><input type="text" name="reviewsPerPage" size="10" onkeypress="return isNumberKey(event)" maxlength="3" value="<?echo $userSettings->getSettingValue(SettingType::KPPStatusPerPage)?>" /></td>
</tr>
<?}?>
<tr>
<td>Team name</td><td><input type="text" name="teamName" value="<?echo $loggedInTeam->teamName?>" maxlength="40" size="40" /></td>
</tr>
<tr>
<tr>
<td><b>Show Tabs</b></td></tr>
<tr>
<tr>
<td>Draft</td><td><input type="checkbox" name="draftTab" <?if ($userSettings->getSettingValue(SettingType::ShowDraftTab) == "YES") {?>checked<?}?> value="YES" /></td>
</tr>
<tr>
<td>Preferences</td><td><input type="checkbox" name="prefTab" <?if ($userSettings->getSettingValue(SettingType::ShowPrefTab) == "YES") {?>checked<?}?> value="YES" /></td>
</tr>
<tr>
<td>Archive</td><td><input type="checkbox" name="archiveTab" <?if ($userSettings->getSettingValue(SettingType::ShowArchiveTab) == "YES") {?>checked<?}?> value="YES" /></td>
</tr>
<?if (KPPStatusBoard::isAuthentic($loggedInTeam->coachName)) {?>
<tr>
<td>KPP Status Review</td><td><input type="checkbox" name="statusTab" <?if ($userSettings->getSettingValue(SettingType::ShowReviewTab) == "YES") {?>checked<?}?> value="YES" /></td>
</tr>
<?}?>
<?if ($loggedInTeam->isAdmin) {?>
<tr>
<td>Overview</td><td><input type="checkbox" name="overviewTab" <?if ($userSettings->getSettingValue(SettingType::ShowOverviewTab) == "YES") {?>checked<?}?> value="YES" /></td>
</tr>
<?}?>
<tr>
<td><input type="button" value="Submit" onclick="validateSettingsForm(this.form)" class="buttonStyle" /></td></tr>
</table>
</form>
<script>
var settingsFormSubmitted = false;
function validateSettingsForm(frm) {
	if (!settingsFormSubmitted) {
		settingsFormSubmitted = true;
		frm.submit();
	}
}
function isNumberKey(evt) {
   var charCode = (evt.which) ? evt.which : event.keyCode
   if (charCode > 31 && (charCode < 48 || charCode > 57))
      return false;

   return true;
}
</script>